#列表
items1 = [35,12,99,68,55,35,87]
items2 = ['python','java','go','kotlin']
items3 = [100,12.3,'python',True]
print(items1)
print(items2)
print(items3)
print(type(items1))
print(type(items2))
print(type(items3))
items4 = list(range(1,10))
items5 = list('hello')
print(items4)
print(items5)
items6 = [30,54,99,78]
items7 = [56,123,47]
items8 = ['python','java','javascript']
print(items6 + items7)
print(items8 + items7)
items5 += items7
print(items5)
print(items6 * 3)
print(items7 * 2)
print(30 in items6)
print(100 in items6)
print('C++' not in items8)
items8 = ['apple','wax berry','pita ya','peach','watermelon']
print(items8[0])
print(items8[2])
print(items8[4])
items8[2] = 'durian'
print(items8)
print(items8[-5])
print(items8[-4])
print(items8[-1])
items8[-4] = 'strawberry'
print(items8)
#希望一次性访问列表中多个元素--用切片--[start:end:stride]
#end位置的元素无法访问
print(items8[1:3:1])
print(items8[0:3:1])
print(items8[0:5:2])
print(items8[-4:-2:1])
print(items8[-2:-6:-1])
#如果start值等于0，end值等于N，N代表列表元素个数，stride值等于1，使用切片运算时可以省略
print(items8[1:3])
print(items8[:3])
print(items8[::2])
print(items8[-4:-2])
print(items8[-2::-1])
items8[1:3] = ['x','o']
print(items8)
nums1 = [1,2,3,4]
nums2 = list(range(1,5))
nums3 = [3,2,1]
print(nums1 == nums2)
print(nums1 != nums2)
print(nums1 <= nums3)
print(nums2 >= nums3)
languages = ['python','java','go','kotlin']
for index in range(len(languages)):
    #len函数可以获取列表元素个数
    print(languages[index])
maths = ['python','java','go','kotlin']
for math in maths:
    print(math)
import random
fs = [0] * 6
for _ in range(6000):
    face = random.randrange(1,7)
    fs[face-1] += 1
for face in range(1,7):
    print(f'{face}点出现了{fs[face-1]}次')